/* Replace "dll.h" with the name of your header */
// --output lilithapi
// --type dll
// --library -L"C:/MinGW32/lib"
// --include -I"C:/MinGW32/include"
// --compile lilithapi.c
// --compile cpuclock.c
// --flag -Wall

//#define DLLIMPORT extern "C" __declspec (dllexport)
#define DLLIMPORT __declspec (dllexport)

#define _WIN32_WINNT 0x500
#include <windows.h>
#include <stdio.h>
#include <string.h>
//#include <boost/multi_array.hpp>
#include "cpuclock.h"

TimeStemp ts;

DLLIMPORT void timer_start(){
	start(&ts);
}

DLLIMPORT void timer_print(){
	end(&ts);
	printf("use: %d\n", (int)get_qt_result(&ts) >> 10);
	reset(&ts);
}

DLLIMPORT int timer_end(){
	int r;
	end(&ts);
	r = ((int)get_qt_result(&ts) >> 10);
	reset(&ts);
	return r;
}


/*
DLLIMPORT void PILImageConvertToBmp(char * lppil, char * lpbmp, int width, int height){ 
	for(int y = 0; y < height; ++y) {
		for(int x = 0; x < width; ++x) {
			int invert_y = (height - y - 1);
			lpbmp[(y * width + x) * 4 + 0] = lppil[(invert_y * width + x) * 4 + 2];
			lpbmp[(y * width + x) * 4 + 1] = lppil[(invert_y * width + x) * 4 + 1];
			lpbmp[(y * width + x) * 4 + 2] = lppil[(invert_y * width + x) * 4 + 0];
			lpbmp[(y * width + x) * 4 + 3] = 0;
		}
	}
}
*/

/*
extern "C" BOOL APIENTRY DllMain (HINSTANCE hInst ,
					   DWORD reason	,
					   LPVOID reserved )
{
	//printf("dllMain");
	//MessageBox( NULL, "DLL DLL_PROCESS_ATTACH", "MESSAGE", MB_ICONINFORMATION );
	
	switch (reason)
	{
	  case DLL_PROCESS_ATTACH:
		break;

	  case DLL_PROCESS_DETACH:
		break;

	  case DLL_THREAD_ATTACH:
		break;

	  case DLL_THREAD_DETACH:
		break;
	}

	// Returns TRUE on success, FALSE on failure
	return TRUE;
}
*/